capture log close
set more off
clear
set mem 200m
set matsize 800

log using "C:\PATH\Vreeland_2008_IO.log", replace

use "C:\PATH\Vreeland_2008_IO.dta", clear



*Correlation of torture measures (footnote 4)
corr torture tort_ciri if reg~=.

 *** *** *** *** *** figure 1:
*Democracies entering into the CAT
*Hathaway - signed
sort torture 
by torture: sum cats if year>1983 & cats_year+1>year & reg==0
*Cing&Rich - signed
sort tort_ciri 
by tort_ciri: sum cats if year>1983 & cats_year+1>year & reg==0
*Hathaway - rat
sort torture 
by torture: sum catr if year>1983 & catr_year+1>year & reg==0
*Cing&Rich - rat
sort tort_ciri 
by tort_ciri: sum catr if year>1983 & catr_year+1>year & reg==0

*Dictatorships entering into the CAT
*Hathaway - signed
sort torture 
by torture: sum cats  if year>1983 & cats_year+1>year & reg==1
*Cing&Rich - signed
sort tort_ciri
by tort_ciri: sum cats  if year>1983 & cats_year+1>year & reg==1
*Hathaway - rat
sort torture 
by torture: sum catr  if year>1983 & catr_year+1>year & reg==1
*Cing&Rich - rat
sort tort_ciri
by tort_ciri: sum catr  if year>1983 & catr_year+1>year & reg==1


*Section 4: Evidence
*"The Hathaway torture data include 967 country-year observations of from 1985 to 1996 covering 109 separate dictatorships."
*"The mean rate of torture is 3.0 with a standard deviation of 1.1; the median is 3"
sum torture year if year>1983 & year<1997 & reg==1 & torture~=., detail
/* "My principal explanatory variable is �parties,� a dummy variable taken from Gandhi (2003, 2006), 
coded 1 if more than one party exists legally and 0 otherwise. 
For the Hathaway data, nearly 52 percent of the observations have multiple political parties." */
sum party year if year>1983 & year<1997 & reg==1 & torture~=.

/* "Average rates of torture under dictatorships without political parties is 2.8 (standard deviation 1.1), 
but rates of torture under dictatorships with political parties is 3.1 (standard deviation 1.0). 
A simple t-test indicates that the difference in average rates of torture 
is statistically significant beyond the 0.01 confidence level (t=-4.44)." */
sort party
ttest torture if reg==1 , by(party)


 *** Table 1: Political parties under dictatorship and levels of torture -- Hathaway torture data
*Ordinal logit
ologit torture party level g population tradegdp war communist if reg==1, robust
*Fixed effects logit
clogit common_tort_hath party level g population tradegdp war communist if reg==1, group(aclpcode) 
*Duration dependence logit
btscs common_tort_hath  year aclpcode, generate (hath_spline) nspline (3)
logit common_tort_hath party level g population tradegdp war communist hath_spline _spline1 _spline2 _spline3 if reg==1, robust


/* "When robust standard errors are included in the fixed effects specification, 
the significance of the �Parties� variable drops to the 10 percent level. 
This, however, is due to the inclusion of irrelevant variables and missing data, 
which is more of a problem for fixed effects models that drop many observations 
in addition to missing data. 
When the insignificant variables � GDP/capita, Growth, Trade/GDP, and civil war � are dropped, 
the level of significance of the Parties coefficient increases to the 5 percent level 
even with robust standard errors. Indeed, the p-value is 0.021." */
clogit common_tort_hath party level g population tradegdp war communist if reg==1, group(aclpcode) robust
clogit common_tort_hath party population communist if reg==1, group(aclpcode) robust

/* Using Clarify software to perform simulations, 
I interpolated the effect of having multiple political parties using the duration dependence logit, 
holding all control variables to their median values. 
When parties are not present (under the �closed� dictatorship), 
the predicted probability of torture is 0.07 (and one can say with 95 percent confidence that the probability of torture is between 0.04 and 0.11). 
When multiple political parties are present, 
the predicted probability of torture is 0.14 (and one can say with 95 percent confidence that the probability of torture is between 0.09 and 0.21). 
The estimated difference in the probabilities is 0.07 (and one can say with 95 percent confidence that the difference is between 0.03 and 0.12).  */
*Note that the following is a simulation and should approximate the published numbers
estsimp logit common_tort_hath party level g population tradegdp war communist hath_spline _spline1 _spline2 _spline3 if reg==1, robust
setx median
*The median time w/no torture in this sample is 2:
*The values of the splines when median non-torture time is set to 2 are:
*_spline1=-8 _spline2=-6.545455 _spline3=-4.363636
setx
setx party 0
simqi, listx
setx party 1
simqi, listx
simqi, fd(prval(1)) changex(party 0 1)

/* Interestingly, when the count and spline variables are held to zero, 
which implies that the government practiced torture during the past year, 
the predicted probability of torture is much higher. 
When parties are not present (under the �closed� dictatorship), 
the predicted probability of torture is 0.36 (with a 95 percent confidence interval of 0.27 to 0.46). 
When multiple political parties are present, the predicted probability of torture is 0.55 (with a 95 percent confidence interval of 0.47 to 0.64). 
The estimated difference in the probabilities is 0.19 (with a 95 percent confidence interval of 0.09 to 0.28). */
setx hath_spline 0 _spline1 0 _spline2 0 _spline3 0
setx party 0
simqi, listx
setx party 1
simqi, listx
simqi, fd(prval(1)) changex(party 0 1)

drop b1 b2 b3 b4 b5 b6 b7 b8 b9 b10 b11 b12 

/* This prompted me to reevaluate the data using a dynamic version of logit, where I tested the effect of parties on the onset of torture... 
Holding all control variables to their median values, 
the difference in the predicted probability of torture when there are not multiple parties versus when there are parties is 
0.06 (with a 95 percent confidence interval of 0.01 to 0.11).  */
*Dynamic logit (torture onset)
estsimp logit common_tort_hath party_lag level_lag g_lag population_lag tradegdp_lag war_lag communist_lag if reg==1 & common_tort_hath_lag==0, robust
setx median
setx party_lag 0
simqi, listx
setx party_lag 1
simqi, listx
simqi, fd(prval(1)) changex(party_lag 0 1)
drop b1 b2 b3 b4 b5 b6 b7 b8


*Table 2: The effect of parties on torture in dictatorships that eventually have parties
ologit torture party level g population tradegdp war communist if reg==1 & cdown<10 & cdown~=., robust
sum party if e(sample)==1
ologit torture party level g population tradegdp war communist if reg==1 & cdown<9 & cdown~=., robust
sum party if e(sample)==1
ologit torture party level g population tradegdp war communist if reg==1 & cdown<8 & cdown~=., robust
sum party if e(sample)==1
ologit torture party level g population tradegdp war communist if reg==1 & cdown<7 & cdown~=., robust
sum party if e(sample)==1
ologit torture party level g population tradegdp war communist if reg==1 & cdown<6 & cdown~=., robust
sum party if e(sample)==1
ologit torture party level g population tradegdp war communist if reg==1 & cdown<5 & cdown~=., robust
sum party if e(sample)==1

clogit common_tort_hath party level g population tradegdp war communist if reg==1 & cdown<10 & cdown~=., group(aclpcode)
sum party if e(sample)==1
clogit common_tort_hath party level g population tradegdp war communist if reg==1 & cdown<9 & cdown~=., group(aclpcode)
sum party if e(sample)==1
clogit common_tort_hath party level g population tradegdp war communist if reg==1 & cdown<8 & cdown~=., group(aclpcode)
sum party if e(sample)==1
clogit common_tort_hath party level g population tradegdp war communist if reg==1 & cdown<7 & cdown~=., group(aclpcode)
sum party if e(sample)==1
clogit common_tort_hath party level g population tradegdp war communist if reg==1 & cdown<6 & cdown~=., group(aclpcode)
sum party if e(sample)==1
clogit common_tort_hath party level g population tradegdp war communist if reg==1 & cdown<5 & cdown~=., group(aclpcode)
sum party if e(sample)==1

logit common_tort_hath party level g population tradegdp war communist hath_spline _spline1 _spline2 _spline3 if reg==1 & cdown<10 & cdown~=., robust
sum party if e(sample)==1
logit common_tort_hath party level g population tradegdp war communist hath_spline _spline1 _spline2 _spline3 if reg==1 & cdown<9 & cdown~=., robust
sum party if e(sample)==1
logit common_tort_hath party level g population tradegdp war communist hath_spline _spline1 _spline2 _spline3 if reg==1 & cdown<8 & cdown~=., robust
sum party if e(sample)==1
logit common_tort_hath party level g population tradegdp war communist hath_spline _spline1 _spline2 _spline3 if reg==1 & cdown<7 & cdown~=., robust
sum party if e(sample)==1
logit common_tort_hath party level g population tradegdp war communist hath_spline _spline1 _spline2 _spline3 if reg==1 & cdown<6 & cdown~=., robust
sum party if e(sample)==1
logit common_tort_hath party level g population tradegdp war communist hath_spline _spline1 _spline2 _spline3 if reg==1 & cdown<5 & cdown~=., robust
sum party if e(sample)==1
drop  hath_spline _spline1 _spline2 _spline3 


*CAT Participation and Political Parties under Dictatorship
/* Out of 119 dictatorships observed from 1985 to 1996, 
46 signed the CAT. 
Only 17 of these were dictatorships that did not have legalized multiple political parties, 
while 29 of them were dictatorships with political parties, ... 
38 dictatorships ratified the CAT � only 12 were dictatorships without parties, 
while 26 of them were dictatorships with parties*/
list aclpcode year cats_year catr_year party if reg==1 & year<1997 & year>1984

/* even though dictatorships with parties represented only 43 percent of the observations in this sample 
(not including years after countries signed) */
sum party if reg==1 & cats_year+1>year & year<1997 & year>1984


/* even though dictatorships with parties represented only 45 percent of the sample 
(not including years after countries ratified) */
sum party if reg==1 & catr_year+1>year & year<1997 & year>1984

/* The following command tells stata that time is measured by "year" for each country ("aclpcode").
Time @ risk begins when the agreement was drafted ("1984") or data of independence (bornyear) (whichever comes later), 
and the event in question is *signing* the Covention Against Torture"cats==1" */
stset year, id(aclpcode) origin(time max(1984,bornyear)) failure(cats==1)
*figure 2:
sts graph if reg==1, by(party)
*Tests indicate that this difference is statistically significant for both signing and ratifying.
sts test party if reg==1

stset year, id(aclpcode) origin(time max(1984,bornyear)) failure(catr==1)
*figure 3:
sts graph if reg==1, by(party)
*Tests indicate that this difference is statistically significant for both signing and ratifying.
sts test party if reg==1

/* While I have tested the relationship using a battery of survival models (results available upon request) - 
including dynamic probit, Cox regression, and exponential hazard models */

stset year, id(aclpcode) origin(time max(1984,bornyear)) failure(cats==1)
probit cats party_lag communist_lag log_tort_lag regscore_lag n_cats_lag muslim_lag level_lag population_lag tradegdp_lag  if cats_lag==0
stcox party communist log_tort regscore n_cats muslim level population tradegdp if reg==1, cluster(aclpcode)   
streg party communist log_tort regscore n_cats muslim level population tradegdp if reg==1, cluster(aclpcode)   dist(exp)



*Table 3: The effect of multiple political parties on CAT participation (Weibull hazard model)
stset year, id(aclpcode) origin(time max(1984,bornyear)) failure(cats==1)
streg party log_tort if reg==1, cluster(aclpcode)   dist(weibull)
streg party communist log_tort regscore n_cats muslim level population tradegdp if reg==1, cluster(aclpcode)   dist(weibull)

stset year, id(aclpcode) origin(time max(1984,bornyear)) failure(catr==1)
streg party log_tort if reg==1, cluster(aclpcode)   dist(weibull)
streg party log_tort communist regscore n_catr muslim level population tradegdp if reg==1, cluster(aclpcode)   dist(weibull)
streg party log_tort communist regscore n_catr muslim population if reg==1, cluster(aclpcode)   dist(weibull)


*CIRI Appendix:
 * "There are 1,002 observations of torture available for the CIRI torture scale, with a mean of 2.4 (standard deviation 0.7)."
sum tort_ciri year if year>1983 & year<1997 & reg==1 & tort_ciri~=., detail

/* "Average rates of torture under dictatorships without political parties is 2.2 (standard deviation 0.7), 
but rates of torture under dictatorships with political parties is 2.4 (standard deviation 0.7). 
A simple t-test indicates that the difference in average rates of torture is statistically significant beyond the 0.01 level (t=-3.60). */
sort party
ttest tort_ciri if reg==1 , by(party)
* Table A1: Political parties under dictatorship and levels of torture -- using CIRI torture measure
*Ordinal logit
ologit tort_ciri party level g population tradegdp war communist if reg==1, robust
*Fixed effects logit
clogit common_tort_ciri party level g population tradegdp war communist if reg==1 , group(aclpcode)
*Duration dependence logit
btscs common_tort_ciri year aclpcode, generate (ciri_spline) nspline (3)
logit common_tort_ciri party level g population tradegdp war communist ciri_spline _spline1 _spline2 _spline3 if reg==1 & year>1983 , robust
drop  ciri_spline _spline1 _spline2 _spline3 
/* Table A2: The effect of multiple political parties on CAT participation -- using CIRI torture measure
(Weibull Hazard Model) -- using Ciri torture measure */
stset year, id(aclpcode) origin(time max(1984,bornyear)) failure(cats==1)
streg party tort_ciri if reg==1, cluster(aclpcode)   dist(weibull)
streg party tort_ciri communist regscore n_cats muslim level population tradegdp if reg==1, cluster(aclpcode)   dist(weibull)

stset year, id(aclpcode) origin(time max(1984,bornyear)) failure(catr==1)
streg party tort_ciri if reg==1, cluster(aclpcode)   dist(weibull)
streg party tort_ciri communist regscore n_catr muslim level population tradegdp if reg==1, cluster(aclpcode)   dist(weibull)
streg party tort_ciri communist regscore n_catr muslim population if reg==1, cluster(aclpcode)   dist(weibull)

*Table A3: Descriptive data
sum level g war communist population regscore n_catr n_cats muslim tradegdp if year>1983 & year<1997 & reg==1
sum party torture tort_ciri if reg==1 & cats_year>year & year>1983 & year<1997
sum party torture tort_ciri if reg==1 & cats_year==year
sum party torture tort_ciri if reg==1 & catr_year>year & year>1983 & year<1997
sum party torture tort_ciri if reg==1 & catr_year==year

log close 
